﻿#region License

// Created by John Batte on 04/08/2012 at 5:22 PM.
// Last code cleanup: 04/15/2012 at 8:02 PM.
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#endregion

namespace BatteCode.Google.Wiki
{
	/// <summary>
	/// 	Provides an abstraction over the Google Code wiki text format.
	/// </summary>
	public class WikiString
	{
		#region Wiki Literals

		/// <summary>
		/// 	A bullet list item.
		/// </summary>
		public const string BulletListItem = "* ";

		/// <summary>
		/// 	A number list item.
		/// </summary>
		public const string NumberListItem = "# ";

		/// <summary>
		/// 	A code format string.
		/// </summary>
		public const string CodeFormat = "`{0}`";

		/// <summary>
		/// 	A code block format string.
		/// </summary>
		public const string CodeBlockFormat = "{{{{{{{0}}}}}}}";

		/// <summary>
		/// 	A language-specific code block format string.
		/// </summary>
		public const string CodeLanguageFormat = "<code language=\"{0}\">{1}</code>";

		/// <summary>
		/// 	A superscript format string.
		/// </summary>
		public const string SuperScriptFormat = "^{0}^";

		/// <summary>
		/// 	A subscript format string.
		/// </summary>
		public const string SubScriptFormat = ",,{0},,";

		/// <summary>
		/// 	A strike-out format string.
		/// </summary>
		public const string StrikeOutFormat = "~~{0}~~";

		/// <summary>
		/// 	A plain text format string.
		/// </summary>
		public const string PlainTextFormat = "<pre>{0}</pre>";

		/// <summary>
		/// 	A level-one heading format string.
		/// </summary>
		public const string HeadingFormatLevel1 = "= {0} =";

		/// <summary>
		/// 	A level-two heading format string.
		/// </summary>
		public const string HeadingFormatLevel2 = "== {0} ==";

		/// <summary>
		/// 	A level-three heading format string.
		/// </summary>
		public const string HeadingFormatLevel3 = "=== {0} ===";

		/// <summary>
		/// 	A level-four heading format string.
		/// </summary>
		public const string HeadingFormatLevel4 = "==== {0} ====";

		/// <summary>
		/// 	A level-five heading format string.
		/// </summary>
		public const string HeadingFormatLevel5 = "===== {0} =====";

		/// <summary>
		/// 	A level-six heading format string.
		/// </summary>
		public const string HeadingFormatLevel6 = "====== {0} ======";

		/// <summary>
		/// 	A labels format string.
		/// </summary>
		public const string LabelsFormat = "#labels {0}";

		/// <summary>
		/// 	A summary format string.
		/// </summary>
		public const string SummaryFormat = "#summary {0}";

		/// <summary>
		/// 	A sidebar format string.
		/// </summary>
		public const string SideBarFormat = "#sidebar {0}";

		/// <summary>
		/// 	An italics format string.
		/// </summary>
		public const string ItalicsFormat = "_{0}_";

		/// <summary>
		/// 	A bold format string.
		/// </summary>
		public const string BoldFormat = "*{0}*";

		/// <summary>
		/// 	A link format string.
		/// </summary>
		public const string WikiLinkFormat = "[{0}{1}{2}]";

		/// <summary>
		/// 	A link text format string.
		/// </summary>
		public const string WikiLinkTextFormat = " {0}";

		/// <summary>
		/// 	A link heading format string.
		/// </summary>
		public const string WikiLinkHeadingFormat = "#{0}";

		/// <summary>
		/// 	A no-link format string.
		/// </summary>
		public const string NoLinkFormat = "!{0}";

		/// <summary>
		/// 	A revision number format string.
		/// </summary>
		public const string RevisionFormat = "r{0}";

		/// <summary>
		/// 	An issue number format string.
		/// </summary>
		public const string IssueFormat = "issue {0}";

		private const string _horizontalRule = "----";

		#endregion

		/// <summary>
		/// 	Gets an empty WikiString.
		/// </summary>
		public static readonly WikiString Empty = new WikiString(string.Empty);

		/// <summary>
		/// 	Gets a horizontal rule.
		/// </summary>
		public static readonly WikiString HorizontalRule = new WikiString(_horizontalRule);

		private readonly string _content;

		/// <summary>
		/// 	Initializes a new instance of the <see cref="WikiString" /> class.
		/// </summary>
		/// <param name="content"> The content. </param>
		public WikiString(string content)
		{
			_content = content;
		}

		/// <summary>
		/// 	Returns a <see cref="System.String" /> that represents this instance.
		/// </summary>
		/// <returns> A <see cref="System.String" /> that represents this instance. </returns>
		public override string ToString()
		{
			return _content;
		}
	}
}